package com.xiaoq.distribution.service;

import com.xiaoq.distribution.entity.TicketOrderItemEntity;
import com.xiaoq.vo.PagingVo;

import java.util.List;

/**
 * Created by chenjh on 2018/5/31.
 */
public interface ITicketOrderItemService {

    boolean save(TicketOrderItemEntity ticketOrderItemEntity);

    boolean updateById(TicketOrderItemEntity ticketOrderItemEntity);

    boolean updateByOrderId(TicketOrderItemEntity ticketOrderItemEntity);

    /**
     *  下单后即结算核销
     * @param orderId 订单id
     * @param distributorId 分销商id
     * @param ticketId 票id
     * @param minCreateTime 订单创建时间
     * @param maxCreateTime 订单创建时间
     * @param payState 支付状态
     * @return
     */
    List<TicketOrderItemEntity> getOrderItemList4CreatedTicketSettle(String orderId, String distributorId, String ticketId, Long minCreateTime, Long maxCreateTime,Integer payState);

    /** 使用后即结算核销
     * @param shopOrderid 订单id
     * @param distributorId 分销商id
     * @param ticketId 票id
     * @param minUseTime （最小）使用（核销）时间
     * @param maxUseTime （最大）使用（核销）时间
     * @param payState 支付状态
     * @return
     */
    List<TicketOrderItemEntity> getOrderItemList4UseTicketSettle(String shopOrderid, String distributorId, String ticketId, Long minUseTime, Long maxUseTime, Integer payState);


    /**
     *  已退款的订单
     * @param shopOrderId
     * @param distributorId
     * @param ticketId
     * @param minRefundTime
     * @param maxRefundTime
     * @param payState
     * @return
     */
    List<TicketOrderItemEntity> getRefundOrderItemList(String shopOrderId,
                                                       String distributorId,
                                                       String ticketId,
                                                       Long minRefundTime,
                                                       Long maxRefundTime,
                                                       Integer payState);

    TicketOrderItemEntity getById(String id);


    List<TicketOrderItemEntity> getListByShopOrderId(String shopOrderId);


    /**
     *  根据电子码，获取订单项信息
     * @param ticketCode
     * @return
     */
    TicketOrderItemEntity getByTicketCode(String ticketCode);


    long getUseOrderItemCountByOrderId(String shopOrderId);

    /**
     * @param shopId 景区id
     * @param orderIdOrItemIdOrTicketCode 可能是 订单号，订单明细号，电子票号
     * @param useBeginTime
     * @param useEndTime
     * @param pagingVo
     * @return
     */
    List<TicketOrderItemEntity> getList4SettleRecord(String shopId, String orderIdOrItemIdOrTicketCode, Long useBeginTime, Long useEndTime, PagingVo pagingVo);

    /**
     *  查询分页
     * @param shopId
     * @param orderIdOrItemIdOrTicketCode
     * @param useBeginTime
     * @param useEndTime
     * @return
     */
    long getCount4SettleRecord(String shopId,String orderIdOrItemIdOrTicketCode, Long useBeginTime, Long useEndTime);
}
